#    pythonequations is a collection of equations expressed as Python classes
#    Copyright (C) 2008 James R. Phillips
#    2548 Vera Cruz Drive
#    Birmingham, AL 35235 USA
#    email: zunzun@zunzun.com
#
#    License: BSD-style (see LICENSE.txt in main source directory)
#    Version info: $Id: __init__.py 267 2010-09-25 13:25:43Z zunzun.com $

import pythonequations, pythonequations.EquationBaseClasses, pythonequations.ExtraCodeForEquationBaseClasses
import numpy
numpy.seterr(all = 'raise') # numpy raises warnings, convert to exceptions to trap them


class LinearLogarithmic3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Linear Logarithmic"
    _HTML = "z = a + b*ln(x) + c*ln(y)"
    coefficientDesignatorTuple = ("a", "b", "c")
    LinearSSQSolverFlag = 1
    CannotAcceptDataWithZeroX = True
    CannotAcceptDataWithNegativeX = True
    CannotAcceptDataWithZeroY = True
    CannotAcceptDataWithNegativeY = True
    function_cpp_code = 'temp = coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i];'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(x_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(y_in);\n"
        return s



class SimplifiedQuadraticLogarithmic3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Simplified Quadratic Logarithmic"
    _HTML = "z = a + b*ln(x) + c*ln(y) + d*ln(x)<SUP>2</SUP> + f*ln(y)<SUP>2</SUP>"
    coefficientDesignatorTuple = ("a", "b", "c", "d", 'f')
    LinearSSQSolverFlag = 1
    CannotAcceptDataWithZeroX = True
    CannotAcceptDataWithNegativeX = True
    CannotAcceptDataWithZeroY = True
    CannotAcceptDataWithNegativeY = True
    function_cpp_code = 'temp = coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[3] * _id[_cwo[3]+i] + coeff[4] * _id[_cwo[4]+i];'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogY(NameOrValueFlag=1, args=[2.0]), [2.0]])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(x_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(y_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(x_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(y_in), 2.0);\n"
        return s



class FullQuadraticLogarithmic3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Full Quadratic Logarithmic"
    _HTML = "z = a + b*ln(x) + c*ln(y) + d*ln(x)<SUP>2</SUP> + f*ln(y)<SUP>2</SUP> + g*ln(x)*ln(y)"
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g")
    LinearSSQSolverFlag = 1
    CannotAcceptDataWithZeroX = True
    CannotAcceptDataWithNegativeX = True
    CannotAcceptDataWithZeroY = True
    CannotAcceptDataWithNegativeY = True
    function_cpp_code = 'temp = coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[3] * _id[_cwo[3]+i] + coeff[4] * _id[_cwo[4]+i] + coeff[5] * _id[_cwo[5]+i];'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogY(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX_LogY(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(x_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(y_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(x_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(y_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[5] + " * log(x_in) * log(y_in);\n"
        return s



class SimplifiedCubicLogarithmic3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Simplified Cubic Logarithmic"
    _HTML = "z = a + b*ln(x) + c*ln(y) + d*ln(x)<SUP>2</SUP> + f*ln(y)<SUP>2</SUP> + g*ln(x)<SUP>3</SUP> + h*ln(y)<SUP>3</SUP>"
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h")
    LinearSSQSolverFlag = 1
    CannotAcceptDataWithZeroX = True
    CannotAcceptDataWithNegativeX = True
    CannotAcceptDataWithZeroY = True
    CannotAcceptDataWithNegativeY = True
    function_cpp_code = 'temp = coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[3] * _id[_cwo[3]+i] + coeff[4] * _id[_cwo[4]+i] + coeff[5] * _id[_cwo[5]+i] + coeff[6] * _id[_cwo[6]+i];'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogY(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX(NameOrValueFlag=1, args=[3.0]), [3.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogY(NameOrValueFlag=1, args=[3.0]), [3.0]])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(x_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(y_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(x_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(y_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[5] + " * pow(log(x_in), 3.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[6] + " * pow(log(y_in), 3.0);\n"
        return s



class FullCubicLogarithmic3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Full Cubic Logarithmic"
    _HTML = "z = a + b*ln(x) + c*ln(y) + d*ln(x)<SUP>2</SUP> + f*ln(y)<SUP>2</SUP> + g*ln(x)<SUP>3</SUP> + h*ln(y)<SUP>3</SUP> + i*ln(x)*ln(y) + j*ln(x)<SUP>2</SUP>*ln(y) + k*ln(x)*ln(y)<SUP>2</SUP>"
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h", "i", "j", "k")
    LinearSSQSolverFlag = 1
    CannotAcceptDataWithZeroX = True
    CannotAcceptDataWithNegativeX = True
    CannotAcceptDataWithZeroY = True
    CannotAcceptDataWithNegativeY = True
    function_cpp_code = 'temp = coeff[0] + coeff[1] * _id[_cwo[1]+i] + coeff[2] * _id[_cwo[2]+i] + coeff[3] * _id[_cwo[3]+i] + coeff[4] * _id[_cwo[4]+i] + coeff[5] * _id[_cwo[5]+i] + coeff[6] * _id[_cwo[6]+i] + coeff[7] * _id[_cwo[7]+i] + coeff[8] * _id[_cwo[8]+i] + coeff[9] * _id[_cwo[9]+i];'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Ones(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogY(NameOrValueFlag=1, args=[2.0]), [2.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX(NameOrValueFlag=1, args=[3.0]), [3.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogY(NameOrValueFlag=1, args=[3.0]), [3.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX_LogY(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX_PowLogY(NameOrValueFlag=1, args=[2.0, 1.0]), [2.0, 1.0]])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_PowLogX_PowLogY(NameOrValueFlag=1, args=[1.0, 2.0]), [1.0, 2.0]])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(x_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(y_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(x_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(y_in), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[5] + " * pow(log(x_in), 3.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[6] + " * pow(log(y_in), 3.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[7] + " * log(x_in) * log(y_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[8] + " * pow(log(x_in), 2.0) * log(y_in);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[9] + " * log(x_in) * pow(log(y_in), 2.0);\n"
        return s



class LinearLogarithmicTransform3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Linear Logarithmic Transform"
    _HTML = "z = a + b*ln(d*x+f) + c*ln(g*y+h)"
    coefficientDesignatorTuple = ("a", "b", "c", 'd', 'f', 'g' 'h')
    function_cpp_code = 'temp = coeff[0] + coeff[1] * log(coeff[3]*_id[_cwo[0]+i]+coeff[4]) + coeff[2] * log(coeff[5]*_id[_cwo[1]+i]+coeff[6]);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Y(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(d * x_in + f);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(g * y_in + h);\n"
        return s



class SimplifiedQuadraticLogarithmicTransform3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Simplified Quadratic Logarithmic Transform"
    _HTML = "z = a + b*ln(g*x+h) + c*ln(i*y+j) + d*ln(g*x+h)<SUP>2</SUP> + f*ln(i*y+j)<SUP>2</SUP>"
    coefficientDesignatorTuple = ("a", "b", "c", "d", 'f', 'g', 'h', 'i', 'j')
    function_cpp_code = 'temp_x_sq = log(coeff[5] * _id[_cwo[0]+i] + coeff[6]);'
    function_cpp_code += 'temp_y_sq = log(coeff[7] * _id[_cwo[1]+i] + coeff[8]);'
    function_cpp_code += 'temp = coeff[0] + coeff[1] * temp_x_sq + coeff[2] * temp_y_sq'
    function_cpp_code += ' + coeff[3] * pow(temp_x_sq, 2.0) + coeff[4] * pow(temp_y_sq, 2.0);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_X(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_Y(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(g * x_in + h);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(i * y_in + j);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(g * x_in + h), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(i * y_in + j), 2.0);\n"
        return s



class FullQuadraticLogarithmicTransform3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Full Quadratic Logarithmic Transform"
    _HTML = "z = a + b*ln(h*x+i) + c*ln(j*y+k) + d*ln(h*x+i)<SUP>2</SUP> + f*ln(j*y+k)<SUP>2</SUP> + g*ln(h*x+i)*ln(j*y+k)"
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", 'h', 'i', 'j', 'k')
    function_cpp_code = 'temp_x_sq = log(coeff[6]*_id[_cwo[0]+i]+coeff[7]);'
    function_cpp_code += 'temp_y_sq = log(coeff[8]*_id[_cwo[1]+i]+coeff[9]);'
    function_cpp_code += 'temp = coeff[0] + coeff[1] * temp_x_sq + coeff[2] * temp_y_sq + '
    function_cpp_code += 'coeff[3] * pow(temp_x_sq, 2.0) + coeff[4] * pow(temp_y_sq, 2.0) + '
    function_cpp_code += 'coeff[5] * temp_x_sq * temp_y_sq;'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(h * x_in + i);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(j * y_in + k);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(h * x_in + i), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(j * y_in + k), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[5] + " * log(h * x_in + i) * log(j * y_in + k);\n"
        return s


class SimplifiedCubicLogarithmicTransform3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Simplified Cubic Logarithmic Transform"
    _HTML = "z = a + b*ln(i*x+j) + c*ln(k*y+m) + d*ln(i*x+j)<SUP>2</SUP> + f*ln(k*y+m)<SUP>2</SUP> + g*ln(i*x+j)<SUP>3</SUP> + h*ln(k*y+m)<SUP>3</SUP>"
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", 'h', 'i', 'j', 'k', 'm')
    function_cpp_code = 'temp_x_sq = log(coeff[7]*_id[_cwo[0]+i]+coeff[8]);'
    function_cpp_code += 'temp_y_sq = log(coeff[9]*_id[_cwo[1]+i]+coeff[10]);'
    function_cpp_code += 'temp = coeff[0] + coeff[1] * temp_x_sq + coeff[2] * temp_y_sq + '
    function_cpp_code += 'coeff[3] * pow(temp_x_sq, 2.0) + coeff[4] * pow(temp_y_sq, 2.0) + '
    function_cpp_code += 'coeff[5] * pow(temp_x_sq, 3.0) + coeff[6] * pow(temp_y_sq, 3.0);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(i * x_in + j);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(k * y_in + m);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(i * x_in + j), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(k * y_in + m), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[5] + " * pow(log(i * x_in + j), 3.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[6] + " * pow(log(k * y_in + m), 3.0);\n"
        return s



class FullCubicLogarithmicTransform3D(pythonequations.EquationBaseClasses.Equation3D):
    RequiresAutoGeneratedGrowthAndDecayForms = True
    RequiresAutoGeneratedOffsetForm = False
    RequiresAutoGeneratedReciprocalForm = True
    RequiresAutoGeneratedInverseForms = True
    _name ="Full Cubic Logarithmic Transform"
    _HTML = "z = a + b*ln(m*x+n) + c*ln(o*y+p) + d*ln(m*x+n)<SUP>2</SUP> + f*ln(o*y+p)<SUP>2</SUP> + g*ln(m*x+n)<SUP>3</SUP> + h*ln(o*y+p)<SUP>3</SUP> + i*ln(m*x+n)*ln(o*y+p) + j*ln(m*x+n)<SUP>2</SUP>*ln(o*y+p) + k*ln(m*x+n)*ln(o*y+p)<SUP>2</SUP>"
    coefficientDesignatorTuple = ("a", "b", "c", "d", "f", "g", "h", "i", "j", 'k', 'm', 'n', 'o', 'p')
    function_cpp_code = 'temp_x_sq = log(coeff[10]*_id[_cwo[0]+i]+coeff[11]);'
    function_cpp_code += 'temp_y_sq = log(coeff[12]*_id[_cwo[1]+i]+coeff[13]);'
    function_cpp_code += 'temp = coeff[0] + coeff[1] * temp_x_sq + coeff[2] * temp_y_sq + '
    function_cpp_code += 'coeff[3] * pow(temp_x_sq, 2.0) + coeff[4] * pow(temp_y_sq, 2.0) + '
    function_cpp_code += 'coeff[5] * pow(temp_x_sq, 3.0) + coeff[6] * pow(temp_y_sq, 3.0) + '
    function_cpp_code += 'coeff[7] * temp_x_sq * temp_y_sq + '
    function_cpp_code += 'coeff[8] * pow(temp_x_sq, 2.0) * temp_y_sq + coeff[9] * temp_x_sq * pow(temp_y_sq, 2.0);'


    def CreateCacheGenerationList(self):
        self.CacheGenerationList = []
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogX(NameOrValueFlag=1), []])
        self.CacheGenerationList.append([pythonequations.ExtraCodeForEquationBaseClasses.CG_LogY(NameOrValueFlag=1), []])

    def SpecificCodeCPP(self):
        s = "\ttemp += " + self.coefficientDesignatorTuple[0] + ";\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[1] + " * log(m * x_in + n);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[2] + " * log(o * y_in + p);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[3] + " * pow(log(m * x_in + n), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[4] + " * pow(log(o * y_in + p), 2.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[5] + " * pow(log(m * x_in + n), 3.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[6] + " * pow(log(o * y_in + p), 3.0);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[7] + " * log(m * x_in + n) * log(o * y_in + p);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[8] + " * pow(log(m * x_in + n), 2.0) * log(o * y_in + p);\n"
        s += "\ttemp += " + self.coefficientDesignatorTuple[9] + " * log(m * x_in + n) * pow(log(o * y_in + p), 2.0);\n"
        return s
